package com.hh.gen;


import cn.hutool.core.text.CharSequenceUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description: 数据库类型
 * @Author: sunshine
 * @Date: 2024-02-28
 */
@Getter
@AllArgsConstructor
public enum DataBaseTypeEnum {

    /**
     * MySQL
     */
    MY_SQL("MySQL"),

    /**
     * Oracle
     */
    ORACLE("Oracle"),

    /**
     * POST_GRE_SQL
     */
    POST_GRE_SQL("PostgreSQL"),

    /**
     * SQL Server
     */
    SQL_SERVER("Microsoft SQL Server");

    private final String type;

    public static DataBaseTypeEnum find(String databaseProductName) {
        if (CharSequenceUtil.isBlank(databaseProductName)) {
            return null;
        }
        for (DataBaseTypeEnum type : values()) {
            if (type.getType().equals(databaseProductName)) {
                return type;
            }
        }
        return null;
    }
}
